/**
 * 
 */
$(document).ready(function($){
	
	var action = "../../general/masters/vehicles/getAll";
	var parameters = "";
	
	getData(action, parameters).done(function(data){
		
		$("table tbody").empty();
		
		$(data).each(function(i, item){
			
			$("table tbody").append(
				"<tr>" +
				"<td><span>" + item.id + "</span></td>" +
				"<td><span>" + item.placa + "</span></td>" +
				"<td><span>" + item.descripcion + "</span></td>" +
				"<td><span><a class='rowo' href='#'><span class='icon-more'></span></a></span></td>" +
				"</tr>"
			);
			
		});
		
		$(".rowo").on("click", function(e){
			
			e.preventDefault();
			
			$(".main .body .cont .data ul").css({
				"top" : $(this).position().top + "px",
				"left": ($(this).position().left - $(".main .body .cont .data ul").width()) + "px",
				"display":"block"
			});
			
		});
		
		$("table tfoot tr td span").empty().html(data.length.toString() + " registros listados...");
		
	});
	
});



function getData(url, parameters){
	
	return $.ajax({
		type: "POST",
		url: url,
		data: parameters,
		dataType: "json"
	});
	
}